<style type="text/css">
	* {
		margin:0;
		padding:0;
	}
	.error_tip{
		height:auto;
		margin-left:20px;
		margin-top:10px;
		width:80%;
	}
</style>

<div class="error_tip"><?php echo $this->getMessagesBlock()->getGroupedHtml() ?></div>
<div id="YellowTitle">
    <?php echo $this->__('Address Book') ?>
</div>

<div id="Title_Content">
    <h2><?php echo $this->__('Account Info') ?></h2>
    <button type="button" class="button" onclick="window.location='<?php echo $this->getAddAddressUrl() ?>';"><span><?php echo $this->__('Add New Address') ?></span></button>
</div>

<div id="YellowTitle">
    <?php echo $this->__('Default Addresses') ?>
</div>

<div style="margin-left:20px">
    <div style="padding-bottom:5px">
        <div class="col2-set">
            <div class="col-1">
                <ol style="margin-top:10px">
                <?php if($_pAddsses = Mage::getSingleton('customer/session')->getCustomer()->getDefaultBilling()): ?>
                    <li>
                        <h4 class="dark-gray bold"><?php echo $this->__('Default Billing Address') ?></h4>
                        <address>
                            <?php echo $this->getAddressHtml(Mage::getSingleton('customer/session')->getCustomer()->getAddressById($_pAddsses)) ?><br />
                            <a class="underline" href="<?php echo $this->getAddressEditUrl(Mage::getSingleton('customer/session')->getCustomer()->getAddressById($_pAddsses)) ?>"><?php echo $this->__('Change Billing Address') ?></a>
                        </address>
                   </li>
                   <?php elseif($_pAddsses = Mage::getSingleton('customer/session')->getCustomer()->getDefaultShipping()): ?>
                   <li>
                        <h4 class="dark-gray bold"><?php echo $this->__('Default Billing Address') ?></h4>
                        <address>
                            <?php echo $this->getAddressHtml(Mage::getSingleton('customer/session')->getCustomer()->getAddressById($_pAddsses)) ?><br />
                            <a class="underline" href="<?php echo $this->getAddressEditUrl(Mage::getSingleton('customer/session')->getCustomer()->getAddressById($_pAddsses)) ?>"><?php echo $this->__('Change Billing Address') ?></a>
                        </address>
                    </li>
                    <?php else: ?>
                    <li>
                        <h4 class="dark-gray bold"><?php echo $this->__('Default Billing Address') ?></h4>
                        <?php echo $this->__('You have no default billing address in your address book.') ?></li>
                    <?php endif ?>
                </ol>
            </div>
            <div class="col-2">
                <ol style="margin-top:10px">
                    <?php if($_pAddsses = Mage::getSingleton('customer/session')->getCustomer()->getDefaultShipping()): ?>
                    <li>
                        <h4 class="dark-gray bold"><?php echo $this->__('Default Shipping Address') ?></h4>
                        <address>
                            <?php echo $this->getAddressHtml(Mage::getSingleton('customer/session')->getCustomer()->getAddressById($_pAddsses)) ?><br />
                            <a class="underline" href="<?php echo $this->getAddressEditUrl(Mage::getSingleton('customer/session')->getCustomer()->getAddressById($_pAddsses)) ?>"><?php echo $this->__('Change Shipping Address') ?></a>
                        </address>
                    </li>
                    <?php elseif($_pAddsses = Mage::getSingleton('customer/session')->getCustomer()->getDefaultBilling()): ?>
                    <li>
                        <h4 class="dark-gray bold"><?php echo $this->__('Default Shipping Address') ?></h4>
                        <address>
                            <?php echo $this->getAddressHtml(Mage::getSingleton('customer/session')->getCustomer()->getAddressById($_pAddsses)) ?><br />
                            <a class="underline" href="<?php echo $this->getAddressEditUrl(Mage::getSingleton('customer/session')->getCustomer()->getAddressById($_pAddsses)) ?>"><?php echo $this->__('Change Shipping Address') ?></a>
                        </address>
                    </li>
                    <?php else: ?>
                    <li>
                        <h4 class="dark-gray bold"><?php echo $this->__('Default Shipping Address') ?></h4><?php echo $this->__('You have no default shipping address in your address book.') ?>
                    </li>
                    <?php endif ?>
                </ol>
            </div>
        </div>
    </div>
    <div>
        <h3 class="sub-title"><?php echo $this->__('Additional Address Entries') ?></h3>
        <ol>
        <?php if($_pAddsses = $this->getAdditionalAddresses()): ?>
            <?php foreach($_pAddsses as $_address): ?>
            <li style="padding:5px 0;border-bottom:1px dotted #898989">
                <address>
                    <?php echo $this->getAddressHtml($_address) ?><br />
                    <a class="underline" href="<?php echo $this->getUrl('customer/address/edit', array('id'=>$_address->getId())) ?>"><?php echo $this->__('Edit Address') ?></a>
                    <span class="separator">|</span>
                    <a class="underline" href="#" onclick="return deleteAddress('<?php echo $_address->getId() ?>');"><?php echo $this->__('Delete Address') ?></a>
                </address>
            </li>
            <?php endforeach; ?>
        <?php else: ?>
            <li><?php echo $this->__('You have no additional address entries in your address book.') ?></li>
        <?php endif ?>
        </ol>
    </div>
</div>
<script type="text/javascript">
//<![CDATA[
    function deleteAddress(addressId) {
        if(confirm('<?php echo $this->__('Are you sure you want to delete this address?') ?>')) {
            window.location='<?php echo $this->getDeleteUrl() ?>id/'+addressId;
        }
        return false;
    }
//]]>
</script>
